package com.DreamTeam.daoProxy;

import java.util.List;

import com.DreamTeam.dao.IEmployeeDao;
import com.DreamTeam.daoImpl.EmployeeDao;
import com.DreamTeam.dbc.MySqlConnection;
import com.DreamTeam.po.Employee;

public class EmployeeDaoProxy implements IEmployeeDao{
	private MySqlConnection conn;
	private IEmployeeDao employeeDao;
	public EmployeeDaoProxy(){
		conn=new MySqlConnection();
		employeeDao = new EmployeeDao(conn.getConnection());
	}

	@Override
	public boolean doAdd(Employee employee) {
		boolean flag = false;
		flag = employeeDao.doAdd(employee);
		conn.closeConnection();
		return flag;
	}

	@Override
	public boolean doUpdate(Employee employee) {
		boolean flag = false;
		flag = employeeDao.doUpdate(employee);
		conn.closeConnection();
		return flag;
	}

	@Override
	public boolean doDelete(Employee employee) {
		boolean flag = false;
		flag = employeeDao.doDelete(employee);
		conn.closeConnection();
		return flag;
	}

	@Override
	public List<Employee> queryEmployeeByColumn(String keyword,String columnName,String orderColumn,String model) {
		List<Employee> list;
		list = employeeDao.queryEmployeeByColumn(keyword,columnName,orderColumn,model);
		conn.closeConnection();
		return list;
	}

	@Override
	public List<Employee> queryEmployeeAll() {
		List<Employee> list;
		list = employeeDao.queryEmployeeAll();
		conn.closeConnection();
		return list;
	}

	@Override
	public List<Employee> queryOrderByColumnName(String columnName,String model) {
		List<Employee> list;
		list = employeeDao.queryOrderByColumnName(columnName,model);
		conn.closeConnection();
		return list;
	}

	@Override
	public List<Employee> queryByKeyword(String keyword) {
		List<Employee> list;
		list = employeeDao.queryByKeyword(keyword);
		conn.closeConnection();
		return list;
	}
	
	
}
